<!DOCTYPE html>
<html>
<body>
<svg style="display: block; width: 0; height: 0">
  <defs>
    <filter id="drop-shadow">
    <feGaussianBlur in="SourceAlpha" stdDeviation="0"/>
    <feOffset dx="0" dy="10" result="offsetblur"/>
    <feFlood flood-color="rgba(0,0,0,1)"/>
    <feComposite in2="offsetblur" operator="in"/>
      <feMerge>
        <feMergeNode/>
        <feMergeNode in="SourceGraphic"/>
      </feMerge>
    </filter>
  </defs>
</svg>
<script>

var canvas = document.createElement('canvas');
canvas.width = 100;
canvas.height = 100;
var ctx = canvas.getContext('2d');

ctx.filter = 'url(#drop-shadow)';
ctx.fillStyle = '#0f0';
ctx.fillRect(25, 25, 50, 40);

document.body.appendChild(canvas);

</script>
</body>
</html>
